
package com.elong.common.util.copy;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;




public class ReadXml {

    public static void main(String[] args) throws Exception {
        File xmlFile = new File("d://globalHotel.xml");
        BufferedReader br = new BufferedReader(new FileReader(xmlFile));
        StringBuffer buffer = new StringBuffer("");
        String str = "";
        while((str = br.readLine()) != null){
            buffer.append(str);
        }
        System.out.println(buffer.toString());
        br.close();
        DocumentBuilderFactory fac = DocumentBuilderFactory.newInstance();
        DocumentBuilder  builder = fac.newDocumentBuilder();
        Document doc = builder.parse(new File("d://globalHotel.xml"));
        NodeList nodes = doc.getElementsByTagName("wsdl:types");
        for(int i = 0; i < nodes.getLength(); i++){
            Element element = (Element) nodes.item(i);
            System.out.println(element.getLocalName());
        }
    }
}
